<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <h2>接口及接口文档</h2>
    省份 <input type="text" name="add" value="山东省">
    城市 <input type="text" name="adb" value="菏泽市">
    <button>测试</button>
    <ul></ul>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script>
        const button=document.querySelector('button')
        const shengfen=document.querySelector('input[name=add]')
        const chengshi=document.querySelector('input[name=adb]')
        const ul=document.querySelector('ul')
        console.log(shengfen,chengshi);
        button.addEventListener('click',async function(){
            const numericalValue=shengfen.value
            const inputBox=chengshi.value
           const {data:res} = await axios({
                url:'http://ajax-api.itheima.net/api/area',
                // method:'GET',
                params:{
                    pname:numericalValue,
                    cname:inputBox
                }
            })
                const {data}=res
                ul.innerHTML=   data.map(item=>{
                    return ` <li>${item}</li>`
                }).join('')
       
        })
    </script>
  </body>
</html>
